<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" href="css/bootstraplan.css">
	<link rel="stylesheet" href="jssuggest/jquery.suggest.css">
	<style type="text/css">
		#person{
			position:relative;
		}
		#info{
			position:absolute;
			top:2px;
			left:40px;
		}
		#pic{
			width:32px;
			height:32px;
			background-position:-112px -148px;
			background-image:url(img/all.png);
			border:1px solid #eee;
		}
		#total{
			position:relative;
		}
		#del{
			position:absolute;
			top:100px;
			left:700px;
			width:100px;
			height:30px;
			padding-left:30px;
		}
		#delpic{
			width:25px;
			height:25px;
			background-position:-560px -103px;
			background-image:url(img/all.png);
		}
	</style>
</head>
<body style="background-color:#f3f1ec">
	<div class="navbar" >
	  <div class="navbar-inner" style="height:60px">
		<a class="brand" href="#"><img src="img/logo-topleft.png" alt="" /></a>
		<a href="" class="btn btn-info" style="margin-top:12px;margin-left:10px">添加日程</a>
		<a href="" class="btn btn-info" style="margin-top:12px">添加联系人</a>
		
		<div class="btn-group pull-right">
            <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
               <i class="icon-user"></i>admin
              <span class="caret"></span>
            </a>
            <ul class="dropdown-menu">
              <li><a href="#"><i class="icon-cog"></i>　密码设置</a></li>
              <li class="divider"></li>
              <li><a href="#"><i class="icon-off"></i>　安全退出</a></li>
            </ul>
          </div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="span3" style="height:400px">
				<div class="wall" style="padding:8px 0;">
					<ul class="nav nav-list" >
						<li class="nav-header" style="padding-top:0px">Welcome!</li>
						<li class="divider"><br></li>
						<li ><a href="home.action"><i class="icon-white icon-home"></i>最新动态</a></li>
						<li><a href="contactlist.action"><i class="icon-user"></i>联系人</a></li>
						<li><a href="task/toCalendar.action"><i class="icon-leaf"></i>日程</a></li>
						<li class="active"><a href="deal.action"><i class="icon-gift"></i>交易</a></li>
						<li><a href="emails.action"><i class="icon-gift"></i>群发邮件</a></li>
					</ul>
				</div>
		</div>
		<div class="span8" style="background-color:#fff;height:600px;border:1px solid #ccc;border-radius:2px;" id="total">
			<div class="wall" style="border-bottom:1px solid #ccc;margin-bottom:5px">
				<div style="background-color:#f0f5f8;height:60px;padding-top:3px">
					<h3 style="padding-top:2px;padding-left:15px">修改交易：aa</h3>
				</div>
			</div>
			<form class="form-horizontal" action="updateDeal.action?id=${deal.id }" method="post" id="myform">
				
				<div class="control-group" >
					<label class="control-label" for="inputEmail">交易对象</label>
					
					<div class="controls" id="person">
						
						<div id="begin" style="margin-bottom:5px;">
							<div id="pic"></div>
							<div id="info">
								${deal.contactList[0].username }<br />
								<a href="javascript:;" id="other">选择其他人</a>
							</div>
						</div>	
						<input type="text" id="search" name="q">
						
					</div>
					
				</div>
				
				
				
				<div class="control-group">
					<label class="control-label" for="inputPassword">交易名称</label>
					<div class="controls">
						<input type="text" id="inputPassword" value="${deal.name }" name="deal.name">
						
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputPassword">交易描述</label>
					<div class="controls">
						<textarea name="deal.desc" id="" class="span5" rows="5">${deal.desc }</textarea>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputPassword">定价</label>
					<div class="controls">
						<div class="input-prepend input-append"><span class="add-on">￥</span><input class="span2" id="appendedPrependedInput" name="deal.money" type="text" value="${deal.money }">
						<select style="margin-left:2px" name="deal.weavestate">
							<c:choose>
								<c:when test="${deal.weavestate == '固定不变' }">
									<option value="固定不变" selected="selected">固定不变</option>
								</c:when>
								<c:otherwise>
									<option value="固定不变">固定不变</option>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${deal.weavestate == '随小时变动' }">
									<option value="随小时变动" selected="selected">随小时变动</option>
								</c:when>
								<c:otherwise>
									<option value="随小时变动">随小时变动</option>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${deal.weavestate == '随月份变动' }">
									<option value="随月份变动" selected="selected">随月份变动</option>
								</c:when>
								<c:otherwise>
									<option value="随月份变动">随月份变动</option>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${deal.weavestate == '随年长变动' }">
									<option value="随年长变动" selected="selected">随年长变动</option>
								</c:when>
								<c:otherwise>
									<option value="随年长变动">随年长变动</option>
								</c:otherwise>
							</c:choose>
						
						</select>
						</div>
						
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="inputPassword">类别</label>
					<div class="controls">
						<select style="margin-left:2px" name="categoryName">
							<c:forEach items="${categoryList }" var="c">
								<option value="${c.type }">${c.type }</option>
							</c:forEach>
							
						</select>
						<a href="editCategorys.action">修改类别</a>
					</div>
				</div>
				<div class="control-group">
					
					<label class="control-label" for="inputPassword">谁可以看到这些类别？</label>
					<div class="controls">
						<select style="margin-left:2px" name="deal.views">
							<c:choose>
								<c:when test="${deal.views == '所有人' }">
									<option value="所有人" selected="selected">所有人</option>
								</c:when>
								<c:otherwise>
									<option value="所有人">所有人</option>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${deal.views == deal.user.username }">
									<option value="只有我" selected="selected">只有我</option>
								</c:when>
								<c:otherwise>
									<option value="只有我">只有我</option>
								</c:otherwise>
							</c:choose>
							<c:choose>
								<c:when test="${deal.views == deal.user.group.name }">
									<option value="同组" selected="selected">我和同组的人</option>
								</c:when>
								<c:otherwise>
									<option value="同组">我和同组的人</option>
								</c:otherwise>
							</c:choose>
							
							
						</select>
					</div>
				</div>
				<div class="form-actions">
					<button type="button" class="btn btn-primary" id="updatebtn">修改交易</button>
					<a href="javascript:window.history.go(-1)" class="btn">取消</a>
				</div>
			</form>				
				
			
			
		</div>
		
	</div>
			
			
		
			
			
			
			
			
			
			
			
			
			
			
			
	
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="jssuggest/jquery.suggest.js"></script>	
	<script type="text/javascript">
		$(document).ready(function(){
			$("#other").click(function(){
				$("#info").hide();
			});
			$("#search").keyup(function(){
				var v = $(this).val();
				if(v == ""){
					$("#info").show();
				}
			});
			$("#search").suggest("ajaxback.action",{
				
			    suggestionColor   : '#cccccc',
			    moreIndicatorClass: 'suggest-more',
			    moreIndicatorText : '&hellip;'
  
			});
			$("#updatebtn").click(function(){
				$("#myform").submit();
			});
		});
	</script>
</body>
</html>